<template>
  <div class="container">
    <page-table :func="func"
    >
      <template v-slot:status="{data}">
        {{ refundStatus[data.row.status] }}
      </template>
	  <template v-slot:remark="{data}">
        {{ data.row | formatRemark }}
      </template>
	  <template v-slot:successTime="{data}">
					{{ data.row.successTime | parseTime }}
	</template>	
    </page-table>

  </div>
</template>
<script>
import pageTable from "@/components/page-table.vue"
import func from "./index.js"
import dayjs from "dayjs"
export default {
	name:"wx_refund",
	components:{
		pageTable
	},
	data(){
		return {
			func,
			refundStatus:{
				"0":"退款中",
				"1":"已退款",
				"2":"退款异常",
				"3":"退款关闭"
			}
		}
	},
	filters:{
		parseTime(date){
			if(!date)return ""
			// return date
			return dayjs(date).format("YYYY-MM-DD HH:mm:ss")
		},
		formatRemark(row){
			if(row.shopName&&row.billNo){
				return `${row.shopName}-${row.billNo}`
			}else if(row.shopName && !row.billNo){
				return `${row.shopName}`
			}else if(!row.shopName && row.billNo){
				return `${row.billNo}`
			}else{
				return ""
			}
		}
	}
}
</script>